package edu.npu.cv.controller.rest;

import edu.npu.cv.constant.ResultCode;
import edu.npu.cv.constant.TemplatePath;
import edu.npu.cv.constant.URLConstant;

import edu.npu.cv.entity.MemberDO;
import edu.npu.cv.entity.PageDO;
import edu.npu.cv.entity.ResultDO;
import edu.npu.cv.enums.Degree;
import edu.npu.cv.service.ArticleService;
import edu.npu.cv.service.MemberService;
import edu.npu.cv.service.PublicationService;
import edu.npu.cv.utils.PageQueryUtil;
import edu.npu.cv.vo.ArticleVO;
import edu.npu.cv.vo.MemberVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.net.URL;
import java.util.Map;

/**
 * @ClassName AdminRestController
 * @Description TODO
 * @Author Quentin_zyj  的 father  lelechang
 * @Date 2021/10/8 20:25
 */
@RestController
@RequestMapping("/adminPublication")
public class PublicationRestController {

    @Autowired
    private PublicationService publicationService;


    @GetMapping("/getPublications")
    public ResultDO<PageDO> getPublications(@RequestParam Map<String, Object> params) {
        if (params.get("page") == null || params.get("limit") == null) {
            return new ResultDO<PageDO>(false, ResultCode.PARAMETER_INVALID, ResultCode.MSG_PARAMETER_INVALID);
        }
        return publicationService.findAll(new PageQueryUtil(params));
    }



}
